/*
 * @Title JOGL.java
 * @Description
 * gluegenrt.jar
 * jogl-all.jar
 * gluegen-rt-natives-windows-amd64.jar
 * jogl-all-natives-windowsamd64.jar
 * @Copyright Copyright(c) 2018
 * @Company com.lizhen
 * @author lizhen
 * @version 0.0.1
 */
package com.lizhen.core.function.jogl;

import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;

import javax.swing.*;

/**
 * @author lizhen
 */
public class JOGL {

    /**
     * @author lizhen
     */
    public JOGL() {
    }

    /**
     * @author lizhen
     */
    public static void main(String[] args) {
        JOGLBasicFrame.main(null);
    }

    static class JOGLBasicFrame implements GLEventListener {
        public static void main(String[] args) {
            final GLProfile profile = GLProfile.get(GLProfile.GL2);
            GLCapabilities capabilities = new GLCapabilities(profile);
            final GLCanvas glcanvas = new GLCanvas(capabilities);
            JOGLBasicFrame jbf = new JOGLBasicFrame();
            glcanvas.addGLEventListener(jbf);
            glcanvas.setSize(400, 400);
            final JFrame frame = new JFrame(" Basic Frame");
            frame.getContentPane().add(glcanvas);
            frame.setSize(frame.getContentPane().getPreferredSize());
            frame.setVisible(true);
        }

        @Override
        public void display(GLAutoDrawable arg0) {
        }

        @Override
        public void dispose(GLAutoDrawable arg0) {
        }

        @Override
        public void init(GLAutoDrawable arg0) {
        }

        @Override
        public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
        }
    }

}

